<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, UnboxedTuples, MagicHash #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# OPTIONS_GHC -fno-warn-name-shadowing #-}</span><span>
</span><span id="line-3"></span><span class="hs-comment">--</span><span>
</span><span id="line-4"></span><span class="hs-comment">--  (c) The University of Glasgow 2002-2006</span><span>
</span><span id="line-5"></span><span class="hs-comment">--</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-8"></span><span class="hs-comment">--      The dynamic linker for object code (.o .so .dll files)</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-comment">-- | Primarily, this module consists of an interface to the C-land</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- dynamic linker.</span><span>
</span><span id="line-13"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHCi.ObjLink</span><span>
</span><span id="line-14"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#initObjLinker"><span class="hs-identifier">initObjLinker</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#ShouldRetainCAFs"><span class="hs-identifier">ShouldRetainCAFs</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-15"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#loadDLL"><span class="hs-identifier">loadDLL</span></a></span><span>
</span><span id="line-16"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#loadArchive"><span class="hs-identifier">loadArchive</span></a></span><span>
</span><span id="line-17"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#loadObj"><span class="hs-identifier">loadObj</span></a></span><span>
</span><span id="line-18"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#unloadObj"><span class="hs-identifier">unloadObj</span></a></span><span>
</span><span id="line-19"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#purgeObj"><span class="hs-identifier">purgeObj</span></a></span><span>
</span><span id="line-20"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#lookupSymbol"><span class="hs-identifier">lookupSymbol</span></a></span><span>
</span><span id="line-21"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#lookupClosure"><span class="hs-identifier">lookupClosure</span></a></span><span>
</span><span id="line-22"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#resolveObjs"><span class="hs-identifier">resolveObjs</span></a></span><span>
</span><span id="line-23"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#addLibrarySearchPath"><span class="hs-identifier">addLibrarySearchPath</span></a></span><span>
</span><span id="line-24"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#removeLibrarySearchPath"><span class="hs-identifier">removeLibrarySearchPath</span></a></span><span>
</span><span id="line-25"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#findSystemLibrary"><span class="hs-identifier">findSystemLibrary</span></a></span><span>
</span><span id="line-26"></span><span>  </span><span class="hs-special">)</span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-comment">-- See note [Why do we import Prelude here?]</span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html"><span class="hs-identifier">GHCi.RemoteTypes</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Exception.html#"><span class="hs-identifier">Control.Exception</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier">throwIO</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exception.html#ErrorCall"><span class="hs-identifier">ErrorCall</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier">when</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.html#"><span class="hs-identifier">Foreign.C</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Marshal.Alloc.html#"><span class="hs-identifier">Foreign.Marshal.Alloc</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Foreign.Marshal.Alloc.html#free"><span class="hs-identifier">free</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.html#"><span class="hs-identifier">Foreign</span></a></span><span>          </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#nullPtr"><span class="hs-identifier">nullPtr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#"><span class="hs-identifier">System.Posix.Internals</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier">CFilePath</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#withFilePath"><span class="hs-identifier">withFilePath</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#peekFilePath"><span class="hs-identifier">peekFilePath</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.html#"><span class="hs-identifier">System.FilePath</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#dropExtension"><span class="hs-identifier">dropExtension</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../filepath/src/System.FilePath.Windows.html#normalise"><span class="hs-identifier">normalise</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-43"></span><span class="hs-comment">-- RTS Linker Interface</span><span>
</span><span id="line-44"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span class="hs-keyword">data</span><span> </span><span id="ShouldRetainCAFs"><span class="annot"><a href="GHCi.ObjLink.html#ShouldRetainCAFs"><span class="hs-identifier hs-var">ShouldRetainCAFs</span></a></span></span><span>
</span><span id="line-47"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="RetainCAFs"><span class="annot"><a href="GHCi.ObjLink.html#RetainCAFs"><span class="hs-identifier hs-var">RetainCAFs</span></a></span></span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-comment">-- ^ Retain CAFs unconditionally in linked Haskell code.</span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-comment">-- Note that this prevents any code from being unloaded.</span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-comment">-- It should not be necessary unless you are GHCi or</span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-comment">-- hs-plugins, which needs to be able call any function</span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-comment">-- in the compiled code.</span><span>
</span><span id="line-53"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="DontRetainCAFs"><span class="annot"><a href="GHCi.ObjLink.html#DontRetainCAFs"><span class="hs-identifier hs-var">DontRetainCAFs</span></a></span></span><span>
</span><span id="line-54"></span><span>    </span><span class="hs-comment">-- ^ Do not retain CAFs.  Everything reachable from foreign</span><span>
</span><span id="line-55"></span><span>    </span><span class="hs-comment">-- exports will be retained, due to the StablePtrs</span><span>
</span><span id="line-56"></span><span>    </span><span class="hs-comment">-- created by the module initialisation code.  unloadObj</span><span>
</span><span id="line-57"></span><span>    </span><span class="hs-comment">-- frees these StablePtrs, which will allow the CAFs to</span><span>
</span><span id="line-58"></span><span>    </span><span class="hs-comment">-- be GC'd and the code to be removed.</span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="annot"><a href="GHCi.ObjLink.html#initObjLinker"><span class="hs-identifier hs-type">initObjLinker</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.ObjLink.html#ShouldRetainCAFs"><span class="hs-identifier hs-type">ShouldRetainCAFs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span id="initObjLinker"><span class="annot"><span class="annottext">initObjLinker :: ShouldRetainCAFs -&gt; IO ()
</span><a href="GHCi.ObjLink.html#initObjLinker"><span class="hs-identifier hs-var hs-var">initObjLinker</span></a></span></span><span> </span><span class="annot"><span class="annottext">ShouldRetainCAFs
</span><a href="GHCi.ObjLink.html#RetainCAFs"><span class="hs-identifier hs-var">RetainCAFs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; IO ()
</span><a href="GHCi.ObjLink.html#c_initLinker_"><span class="hs-identifier hs-var">c_initLinker_</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">1</span></span><span>
</span><span id="line-62"></span><span class="annot"><a href="GHCi.ObjLink.html#initObjLinker"><span class="hs-identifier hs-var">initObjLinker</span></a></span><span> </span><span class="annot"><span class="annottext">ShouldRetainCAFs
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CInt -&gt; IO ()
</span><a href="GHCi.ObjLink.html#c_initLinker_"><span class="hs-identifier hs-var">c_initLinker_</span></a></span><span> </span><span class="annot"><span class="annottext">CInt
</span><span class="hs-number">0</span></span><span>
</span><span id="line-63"></span><span>
</span><span id="line-64"></span><span id="local-6989586621679087885"><span class="annot"><a href="GHCi.ObjLink.html#lookupSymbol"><span class="hs-identifier hs-type">lookupSymbol</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087885"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span></span><span>
</span><span id="line-65"></span><span id="lookupSymbol"><span class="annot"><span class="annottext">lookupSymbol :: forall a. String -&gt; IO (Maybe (Ptr a))
</span><a href="GHCi.ObjLink.html#lookupSymbol"><span class="hs-identifier hs-var hs-var">lookupSymbol</span></a></span></span><span> </span><span id="local-6989586621679087775"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087775"><span class="hs-identifier hs-var">str_in</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-66"></span><span>   </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679087774"><span class="annot"><span class="annottext">str :: String
</span><a href="#local-6989586621679087774"><span class="hs-identifier hs-var hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="GHCi.ObjLink.html#prefixUnderscore"><span class="hs-identifier hs-var">prefixUnderscore</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087775"><span class="hs-identifier hs-var">str_in</span></a></span><span>
</span><span id="line-67"></span><span>   </span><span class="annot"><span class="annottext">String -&gt; (CString -&gt; IO (Maybe (Ptr a))) -&gt; IO (Maybe (Ptr a))
forall a. String -&gt; (CString -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/Foreign.C.String.html#withCAString"><span class="hs-identifier hs-var">withCAString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087774"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">((CString -&gt; IO (Maybe (Ptr a))) -&gt; IO (Maybe (Ptr a)))
-&gt; (CString -&gt; IO (Maybe (Ptr a))) -&gt; IO (Maybe (Ptr a))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679087771"><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679087771"><span class="hs-identifier hs-var">c_str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-68"></span><span>     </span><span id="local-6989586621679087770"><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679087770"><span class="hs-identifier hs-var">addr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CString -&gt; IO (Ptr a)
forall a. CString -&gt; IO (Ptr a)
</span><a href="GHCi.ObjLink.html#c_lookupSymbol"><span class="hs-identifier hs-var">c_lookupSymbol</span></a></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679087771"><span class="hs-identifier hs-var">c_str</span></a></span><span>
</span><span id="line-69"></span><span>     </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679087770"><span class="hs-identifier hs-var">addr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a -&gt; Ptr a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Ptr a
forall a. Ptr a
</span><a href="../../base/src/GHC.Ptr.html#nullPtr"><span class="hs-identifier hs-var">nullPtr</span></a></span><span>
</span><span id="line-70"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe (Ptr a) -&gt; IO (Maybe (Ptr a))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Ptr a)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-71"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Maybe (Ptr a) -&gt; IO (Maybe (Ptr a))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr a -&gt; Maybe (Ptr a)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr a
</span><a href="#local-6989586621679087770"><span class="hs-identifier hs-var">addr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-72"></span><span>
</span><span id="line-73"></span><span class="annot"><a href="GHCi.ObjLink.html#lookupClosure"><span class="hs-identifier hs-type">lookupClosure</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHCi.RemoteTypes.html#HValueRef"><span class="hs-identifier hs-type">HValueRef</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span id="lookupClosure"><span class="annot"><span class="annottext">lookupClosure :: String -&gt; IO (Maybe HValueRef)
</span><a href="GHCi.ObjLink.html#lookupClosure"><span class="hs-identifier hs-var hs-var">lookupClosure</span></a></span></span><span> </span><span id="local-6989586621679087768"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087768"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-75"></span><span>  </span><span id="local-6989586621679087767"><span class="annot"><span class="annottext">Maybe (Ptr Any)
</span><a href="#local-6989586621679087767"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; IO (Maybe (Ptr Any))
forall a. String -&gt; IO (Maybe (Ptr a))
</span><a href="GHCi.ObjLink.html#lookupSymbol"><span class="hs-identifier hs-var">lookupSymbol</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087768"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-76"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (Ptr Any)
</span><a href="#local-6989586621679087767"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-77"></span><span>    </span><span class="annot"><span class="annottext">Maybe (Ptr Any)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe HValueRef -&gt; IO (Maybe HValueRef)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe HValueRef
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-78"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span id="local-6989586621679087765"><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679087765"><span class="hs-identifier hs-var">addr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Addr# -&gt; (# Any #)
forall a. Addr# -&gt; (# a #)
</span><span class="hs-identifier hs-var">addrToAny#</span></span><span> </span><span class="annot"><span class="annottext">Addr#
</span><a href="#local-6989586621679087765"><span class="hs-identifier hs-var">addr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-79"></span><span>      </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679087764"><span class="annot"><span class="annottext">Any
</span><a href="#local-6989586621679087764"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HValueRef -&gt; Maybe HValueRef
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(HValueRef -&gt; Maybe HValueRef)
-&gt; IO HValueRef -&gt; IO (Maybe HValueRef)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HValue -&gt; IO HValueRef
forall a. a -&gt; IO (RemoteRef a)
</span><a href="GHCi.RemoteTypes.html#mkRemoteRef"><span class="hs-identifier hs-var">mkRemoteRef</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Any -&gt; HValue
</span><a href="GHCi.RemoteTypes.html#HValue"><span class="hs-identifier hs-var">HValue</span></a></span><span> </span><span class="annot"><span class="annottext">Any
</span><a href="#local-6989586621679087764"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="annot"><a href="GHCi.ObjLink.html#prefixUnderscore"><span class="hs-identifier hs-type">prefixUnderscore</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-82"></span><span id="prefixUnderscore"><span class="annot"><span class="annottext">prefixUnderscore :: String -&gt; String
</span><a href="GHCi.ObjLink.html#prefixUnderscore"><span class="hs-identifier hs-var hs-var">prefixUnderscore</span></a></span></span><span>
</span><span id="line-83"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHCi.ObjLink.html#cLeadingUnderscore"><span class="hs-identifier hs-var">cLeadingUnderscore</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'_'</span></span><span class="annot"><span class="annottext">Char -&gt; String -&gt; String
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span>
</span><span id="line-84"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-85"></span><span>
</span><span id="line-86"></span><span class="hs-comment">-- | loadDLL loads a dynamic library using the OS's native linker</span><span>
</span><span id="line-87"></span><span class="hs-comment">-- (i.e. dlopen() on Unix, LoadLibrary() on Windows).  It takes either</span><span>
</span><span id="line-88"></span><span class="hs-comment">-- an absolute pathname to the file, or a relative filename</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- (e.g. &quot;libfoo.so&quot; or &quot;foo.dll&quot;).  In the latter case, loadDLL</span><span>
</span><span id="line-90"></span><span class="hs-comment">-- searches the standard locations for the appropriate library.</span><span>
</span><span id="line-91"></span><span class="hs-comment">--</span><span>
</span><span id="line-92"></span><span class="annot"><a href="GHCi.ObjLink.html#loadDLL"><span class="hs-identifier hs-type">loadDLL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-93"></span><span class="hs-comment">-- Nothing      =&gt; success</span><span>
</span><span id="line-94"></span><span class="hs-comment">-- Just err_msg =&gt; failure</span><span>
</span><span id="line-95"></span><span id="loadDLL"><span class="annot"><span class="annottext">loadDLL :: String -&gt; IO (Maybe String)
</span><a href="GHCi.ObjLink.html#loadDLL"><span class="hs-identifier hs-var hs-var">loadDLL</span></a></span></span><span> </span><span id="local-6989586621679087758"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087758"><span class="hs-identifier hs-var">str0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-96"></span><span>  </span><span class="hs-keyword">let</span><span>
</span><span id="line-97"></span><span>     </span><span class="hs-comment">-- On Windows, addDLL takes a filename without an extension, because</span><span>
</span><span id="line-98"></span><span>     </span><span class="hs-comment">-- it tries adding both .dll and .drv.  To keep things uniform in the</span><span>
</span><span id="line-99"></span><span>     </span><span class="hs-comment">-- layers above, loadDLL always takes a filename with an extension, and</span><span>
</span><span id="line-100"></span><span>     </span><span class="hs-comment">-- we drop it here on Windows only.</span><span>
</span><span id="line-101"></span><span>     </span><span id="local-6989586621679087757"><span class="annot"><span class="annottext">str :: String
</span><a href="#local-6989586621679087757"><span class="hs-identifier hs-var hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="GHCi.ObjLink.html#isWindowsHost"><span class="hs-identifier hs-var">isWindowsHost</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#dropExtension"><span class="hs-identifier hs-var">dropExtension</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087758"><span class="hs-identifier hs-var">str0</span></a></span><span>
</span><span id="line-102"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087758"><span class="hs-identifier hs-var">str0</span></a></span><span>
</span><span id="line-103"></span><span>  </span><span class="hs-comment">--</span><span>
</span><span id="line-104"></span><span>  </span><span id="local-6989586621679087755"><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679087755"><span class="hs-identifier hs-var">maybe_errmsg</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; (CFilePath -&gt; IO CString) -&gt; IO CString
forall a. String -&gt; (CFilePath -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var">withFilePath</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="../../filepath/src/System.FilePath.Windows.html#normalise"><span class="hs-identifier hs-var">normalise</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087757"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((CFilePath -&gt; IO CString) -&gt; IO CString)
-&gt; (CFilePath -&gt; IO CString) -&gt; IO CString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679087754"><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087754"><span class="hs-identifier hs-var">dll</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; IO CString
</span><a href="GHCi.ObjLink.html#c_addDLL"><span class="hs-identifier hs-var">c_addDLL</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087754"><span class="hs-identifier hs-var">dll</span></a></span><span>
</span><span id="line-105"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679087755"><span class="hs-identifier hs-var">maybe_errmsg</span></a></span><span> </span><span class="annot"><span class="annottext">CString -&gt; CString -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">CString
forall a. Ptr a
</span><a href="../../base/src/GHC.Ptr.html#nullPtr"><span class="hs-identifier hs-var">nullPtr</span></a></span><span>
</span><span id="line-106"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-107"></span><span>        </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679087752"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087752"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CString -&gt; IO String
</span><a href="../../base/src/Foreign.C.String.html#peekCString"><span class="hs-identifier hs-var">peekCString</span></a></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679087755"><span class="hs-identifier hs-var">maybe_errmsg</span></a></span><span>
</span><span id="line-108"></span><span>                </span><span class="annot"><span class="annottext">CString -&gt; IO ()
forall a. Ptr a -&gt; IO ()
</span><a href="../../base/src/Foreign.Marshal.Alloc.html#free"><span class="hs-identifier hs-var">free</span></a></span><span> </span><span class="annot"><span class="annottext">CString
</span><a href="#local-6989586621679087755"><span class="hs-identifier hs-var">maybe_errmsg</span></a></span><span>
</span><span id="line-109"></span><span>                </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Maybe String
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087752"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span class="annot"><a href="GHCi.ObjLink.html#loadArchive"><span class="hs-identifier hs-type">loadArchive</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span id="loadArchive"><span class="annot"><span class="annottext">loadArchive :: String -&gt; IO ()
</span><a href="GHCi.ObjLink.html#loadArchive"><span class="hs-identifier hs-var hs-var">loadArchive</span></a></span></span><span> </span><span id="local-6989586621679087750"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087750"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-113"></span><span>   </span><span class="annot"><span class="annottext">String -&gt; (CFilePath -&gt; IO ()) -&gt; IO ()
forall a. String -&gt; (CFilePath -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var">withFilePath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087750"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">((CFilePath -&gt; IO ()) -&gt; IO ()) -&gt; (CFilePath -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679087749"><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087749"><span class="hs-identifier hs-var">c_str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-114"></span><span>     </span><span id="local-6989586621679087748"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087748"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; IO Int
</span><a href="GHCi.ObjLink.html#c_loadArchive"><span class="hs-identifier hs-var">c_loadArchive</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087749"><span class="hs-identifier hs-var">c_str</span></a></span><span>
</span><span id="line-115"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087748"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ErrorCall -&gt; IO ()
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; ErrorCall
</span><a href="../../base/src/GHC.Exception.html#ErrorCall"><span class="hs-identifier hs-var">ErrorCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;loadArchive &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087750"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: failed&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span class="annot"><a href="GHCi.ObjLink.html#loadObj"><span class="hs-identifier hs-type">loadObj</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-118"></span><span id="loadObj"><span class="annot"><span class="annottext">loadObj :: String -&gt; IO ()
</span><a href="GHCi.ObjLink.html#loadObj"><span class="hs-identifier hs-var hs-var">loadObj</span></a></span></span><span> </span><span id="local-6989586621679087744"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087744"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-119"></span><span>   </span><span class="annot"><span class="annottext">String -&gt; (CFilePath -&gt; IO ()) -&gt; IO ()
forall a. String -&gt; (CFilePath -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var">withFilePath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087744"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">((CFilePath -&gt; IO ()) -&gt; IO ()) -&gt; (CFilePath -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679087743"><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087743"><span class="hs-identifier hs-var">c_str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-120"></span><span>     </span><span id="local-6989586621679087742"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087742"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; IO Int
</span><a href="GHCi.ObjLink.html#c_loadObj"><span class="hs-identifier hs-var">c_loadObj</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087743"><span class="hs-identifier hs-var">c_str</span></a></span><span>
</span><span id="line-121"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087742"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ErrorCall -&gt; IO ()
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; ErrorCall
</span><a href="../../base/src/GHC.Exception.html#ErrorCall"><span class="hs-identifier hs-var">ErrorCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;loadObj &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087744"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: failed&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-122"></span><span>
</span><span id="line-123"></span><span class="hs-comment">-- | @unloadObj@ drops the given dynamic library from the symbol table</span><span>
</span><span id="line-124"></span><span class="hs-comment">-- as well as enables the library to be removed from memory during</span><span>
</span><span id="line-125"></span><span class="hs-comment">-- a future major GC.</span><span>
</span><span id="line-126"></span><span class="annot"><a href="GHCi.ObjLink.html#unloadObj"><span class="hs-identifier hs-type">unloadObj</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span id="unloadObj"><span class="annot"><span class="annottext">unloadObj :: String -&gt; IO ()
</span><a href="GHCi.ObjLink.html#unloadObj"><span class="hs-identifier hs-var hs-var">unloadObj</span></a></span></span><span> </span><span id="local-6989586621679087740"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087740"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-128"></span><span>   </span><span class="annot"><span class="annottext">String -&gt; (CFilePath -&gt; IO ()) -&gt; IO ()
forall a. String -&gt; (CFilePath -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var">withFilePath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087740"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">((CFilePath -&gt; IO ()) -&gt; IO ()) -&gt; (CFilePath -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679087739"><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087739"><span class="hs-identifier hs-var">c_str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-129"></span><span>     </span><span id="local-6989586621679087738"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087738"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; IO Int
</span><a href="GHCi.ObjLink.html#c_unloadObj"><span class="hs-identifier hs-var">c_unloadObj</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087739"><span class="hs-identifier hs-var">c_str</span></a></span><span>
</span><span id="line-130"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087738"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ErrorCall -&gt; IO ()
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; ErrorCall
</span><a href="../../base/src/GHC.Exception.html#ErrorCall"><span class="hs-identifier hs-var">ErrorCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unloadObj &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087740"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: failed&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span class="hs-comment">-- | @purgeObj@ drops the symbols for the dynamic library from the symbol</span><span>
</span><span id="line-133"></span><span class="hs-comment">-- table. Unlike 'unloadObj', the library will not be dropped memory during</span><span>
</span><span id="line-134"></span><span class="hs-comment">-- a future major GC.</span><span>
</span><span id="line-135"></span><span class="annot"><a href="GHCi.ObjLink.html#purgeObj"><span class="hs-identifier hs-type">purgeObj</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-136"></span><span id="purgeObj"><span class="annot"><span class="annottext">purgeObj :: String -&gt; IO ()
</span><a href="GHCi.ObjLink.html#purgeObj"><span class="hs-identifier hs-var hs-var">purgeObj</span></a></span></span><span> </span><span id="local-6989586621679087736"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087736"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-137"></span><span>   </span><span class="annot"><span class="annottext">String -&gt; (CFilePath -&gt; IO ()) -&gt; IO ()
forall a. String -&gt; (CFilePath -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var">withFilePath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087736"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">((CFilePath -&gt; IO ()) -&gt; IO ()) -&gt; (CFilePath -&gt; IO ()) -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621679087735"><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087735"><span class="hs-identifier hs-var">c_str</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-138"></span><span>     </span><span id="local-6989586621679087734"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087734"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; IO Int
</span><a href="GHCi.ObjLink.html#c_purgeObj"><span class="hs-identifier hs-var">c_purgeObj</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087735"><span class="hs-identifier hs-var">c_str</span></a></span><span>
</span><span id="line-139"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087734"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ErrorCall -&gt; IO ()
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; ErrorCall
</span><a href="../../base/src/GHC.Exception.html#ErrorCall"><span class="hs-identifier hs-var">ErrorCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;purgeObj &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087736"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: failed&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span class="annot"><a href="GHCi.ObjLink.html#addLibrarySearchPath"><span class="hs-identifier hs-type">addLibrarySearchPath</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-142"></span><span id="addLibrarySearchPath"><span class="annot"><span class="annottext">addLibrarySearchPath :: String -&gt; IO (Ptr ())
</span><a href="GHCi.ObjLink.html#addLibrarySearchPath"><span class="hs-identifier hs-var hs-var">addLibrarySearchPath</span></a></span></span><span> </span><span id="local-6989586621679087732"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087732"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-143"></span><span>   </span><span class="annot"><span class="annottext">String -&gt; (CFilePath -&gt; IO (Ptr ())) -&gt; IO (Ptr ())
forall a. String -&gt; (CFilePath -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var">withFilePath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087732"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; IO (Ptr ())
</span><a href="GHCi.ObjLink.html#c_addLibrarySearchPath"><span class="hs-identifier hs-var">c_addLibrarySearchPath</span></a></span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="annot"><a href="GHCi.ObjLink.html#removeLibrarySearchPath"><span class="hs-identifier hs-type">removeLibrarySearchPath</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-146"></span><span id="removeLibrarySearchPath"><span class="annot"><span class="annottext">removeLibrarySearchPath :: Ptr () -&gt; IO Bool
</span><a href="GHCi.ObjLink.html#removeLibrarySearchPath"><span class="hs-identifier hs-var hs-var">removeLibrarySearchPath</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr () -&gt; IO Bool
</span><a href="GHCi.ObjLink.html#c_removeLibrarySearchPath"><span class="hs-identifier hs-var">c_removeLibrarySearchPath</span></a></span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="annot"><a href="GHCi.ObjLink.html#findSystemLibrary"><span class="hs-identifier hs-type">findSystemLibrary</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-149"></span><span id="findSystemLibrary"><span class="annot"><span class="annottext">findSystemLibrary :: String -&gt; IO (Maybe String)
</span><a href="GHCi.ObjLink.html#findSystemLibrary"><span class="hs-identifier hs-var hs-var">findSystemLibrary</span></a></span></span><span> </span><span id="local-6989586621679087729"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087729"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-150"></span><span>    </span><span id="local-6989586621679087728"><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087728"><span class="hs-identifier hs-var">result</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">String -&gt; (CFilePath -&gt; IO CFilePath) -&gt; IO CFilePath
forall a. String -&gt; (CFilePath -&gt; IO a) -&gt; IO a
</span><a href="../../base/src/System.Posix.Internals.html#withFilePath"><span class="hs-identifier hs-var">withFilePath</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087729"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; IO CFilePath
</span><a href="GHCi.ObjLink.html#c_findSystemLibrary"><span class="hs-identifier hs-var">c_findSystemLibrary</span></a></span><span>
</span><span id="line-151"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087728"><span class="hs-identifier hs-var">result</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; CFilePath -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">CFilePath
forall a. Ptr a
</span><a href="../../base/src/GHC.Ptr.html#nullPtr"><span class="hs-identifier hs-var">nullPtr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-152"></span><span>        </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe String
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-153"></span><span>        </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679087726"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087726"><span class="hs-identifier hs-var">path</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CFilePath -&gt; IO String
</span><a href="../../base/src/System.Posix.Internals.html#peekFilePath"><span class="hs-identifier hs-var">peekFilePath</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087728"><span class="hs-identifier hs-var">result</span></a></span><span>
</span><span id="line-154"></span><span>                    </span><span class="annot"><span class="annottext">CFilePath -&gt; IO ()
forall a. Ptr a -&gt; IO ()
</span><a href="../../base/src/Foreign.Marshal.Alloc.html#free"><span class="hs-identifier hs-var">free</span></a></span><span> </span><span class="annot"><span class="annottext">CFilePath
</span><a href="#local-6989586621679087728"><span class="hs-identifier hs-var">result</span></a></span><span>
</span><span id="line-155"></span><span>                    </span><span class="annot"><span class="annottext">Maybe String -&gt; IO (Maybe String)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe String -&gt; IO (Maybe String))
-&gt; Maybe String -&gt; IO (Maybe String)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe String
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679087726"><span class="hs-identifier hs-var">path</span></a></span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span class="annot"><a href="GHCi.ObjLink.html#resolveObjs"><span class="hs-identifier hs-type">resolveObjs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-158"></span><span id="resolveObjs"><span class="annot"><span class="annottext">resolveObjs :: IO Bool
</span><a href="GHCi.ObjLink.html#resolveObjs"><span class="hs-identifier hs-var hs-var">resolveObjs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-159"></span><span>   </span><span id="local-6989586621679087725"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087725"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IO Int
</span><a href="GHCi.ObjLink.html#c_resolveObjs"><span class="hs-identifier hs-var">c_resolveObjs</span></a></span><span>
</span><span id="line-160"></span><span>   </span><span class="annot"><span class="annottext">Bool -&gt; IO Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679087725"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span>
</span><span id="line-162"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-163"></span><span class="hs-comment">-- Foreign declarations to RTS entry points which does the real work;</span><span>
</span><span id="line-164"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;addDLL&quot;</span></span><span>                  </span><span id="c_addDLL"><span class="annot"><a href="GHCi.ObjLink.html#c_addDLL"><span class="hs-identifier hs-var">c_addDLL</span></a></span></span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span>
</span><span id="line-167"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;initLinker_&quot;</span></span><span>             </span><span id="c_initLinker_"><span class="annot"><a href="GHCi.ObjLink.html#c_initLinker_"><span class="hs-identifier hs-var">c_initLinker_</span></a></span></span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CInt"><span class="hs-identifier hs-type">CInt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span id="local-6989586621679087879"><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;lookupSymbol&quot;</span></span><span>            </span><span id="c_lookupSymbol"><span class="annot"><a href="GHCi.ObjLink.html#c_lookupSymbol"><span class="hs-identifier hs-var">c_lookupSymbol</span></a></span></span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.String.html#CString"><span class="hs-identifier hs-type">CString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679087879"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-169"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;loadArchive&quot;</span></span><span>             </span><span id="c_loadArchive"><span class="annot"><a href="GHCi.ObjLink.html#c_loadArchive"><span class="hs-identifier hs-var">c_loadArchive</span></a></span></span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-170"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;loadObj&quot;</span></span><span>                 </span><span id="c_loadObj"><span class="annot"><a href="GHCi.ObjLink.html#c_loadObj"><span class="hs-identifier hs-var">c_loadObj</span></a></span></span><span>                 </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-171"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;purgeObj&quot;</span></span><span>                </span><span id="c_purgeObj"><span class="annot"><a href="GHCi.ObjLink.html#c_purgeObj"><span class="hs-identifier hs-var">c_purgeObj</span></a></span></span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-172"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;unloadObj&quot;</span></span><span>               </span><span id="c_unloadObj"><span class="annot"><a href="GHCi.ObjLink.html#c_unloadObj"><span class="hs-identifier hs-var">c_unloadObj</span></a></span></span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-173"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;resolveObjs&quot;</span></span><span>             </span><span id="c_resolveObjs"><span class="annot"><a href="GHCi.ObjLink.html#c_resolveObjs"><span class="hs-identifier hs-var">c_resolveObjs</span></a></span></span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-174"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;addLibrarySearchPath&quot;</span></span><span>    </span><span id="c_addLibrarySearchPath"><span class="annot"><a href="GHCi.ObjLink.html#c_addLibrarySearchPath"><span class="hs-identifier hs-var">c_addLibrarySearchPath</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;findSystemLibrary&quot;</span></span><span>       </span><span id="c_findSystemLibrary"><span class="annot"><a href="GHCi.ObjLink.html#c_findSystemLibrary"><span class="hs-identifier hs-var">c_findSystemLibrary</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="../../base/src/System.Posix.Internals.html#CFilePath"><span class="hs-identifier hs-type">CFilePath</span></a></span><span>
</span><span id="line-176"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-keyword">unsafe</span></span><span> </span><span class="annot"><span class="hs-string">&quot;removeLibrarySearchPath&quot;</span></span><span> </span><span id="c_removeLibrarySearchPath"><span class="annot"><a href="GHCi.ObjLink.html#c_removeLibrarySearchPath"><span class="hs-identifier hs-var">c_removeLibrarySearchPath</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-179"></span><span class="hs-comment">-- Configuration</span><span class="hs-cpp">

#include &quot;ghcautoconf.h&quot;
</span><span>
</span><span id="line-183"></span><span class="annot"><a href="GHCi.ObjLink.html#cLeadingUnderscore"><span class="hs-identifier hs-type">cLeadingUnderscore</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-cpp">
#if defined(LEADING_UNDERSCORE)
</span><span class="hs-identifier">cLeadingUnderscore</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">True</span><span class="hs-cpp">
#else
</span><span id="cLeadingUnderscore"><span class="annot"><span class="annottext">cLeadingUnderscore :: Bool
</span><a href="GHCi.ObjLink.html#cLeadingUnderscore"><span class="hs-identifier hs-var hs-var">cLeadingUnderscore</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-190"></span><span class="annot"><a href="GHCi.ObjLink.html#isWindowsHost"><span class="hs-identifier hs-type">isWindowsHost</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-cpp">
#if defined(mingw32_HOST_OS)
</span><span id="isWindowsHost"><span class="annot"><span class="annottext">isWindowsHost :: Bool
</span><a href="GHCi.ObjLink.html#isWindowsHost"><span class="hs-identifier hs-var hs-var">isWindowsHost</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-cpp">
#else
</span><span class="hs-identifier">isWindowsHost</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">False</span><span class="hs-cpp">
#endif
</span></pre></body></html>